package com.dolphin.aiagentplatform.constant;

/**
 * 用户角色枚举
 *
 * @author dolphin
 */
public enum UserRoleConst {

    ADMIN(0, "管理员"),
    NORMAL(1, "普通用户"),
    VIP(2, "VIP用户");

    /**
     * 角色编码
     */
    private final int code;

    /**
     * 角色描述
     */
    private final String description;

    UserRoleConst(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static UserRoleConst getByCode(int code) {
        for (UserRoleConst role : values()) {
            if (role.getCode() == code) {
                return role;
            }
        }
        return NORMAL; // 默认返回普通用户
    }
}
